// // 引用封装axios
// import request from '../request/request'
import { baseUrl } from '../common/config.js'
// 排行榜接口
export function rankList(){
	let listIds = ['3','0','2','1']
	return new Promise (function(reslove,reject){
		uni.request({
			url: `${baseUrl}/toplist/detail`,
			method: 'GET',
			data: {},
			success: res => {
				let result = res.data.list;
				result.length = 4;
				for(var i = 0 ; i <listIds.length ; i++){
					result[i].listId = listIds[i]
				}
				reslove(result)
			},
			fail: () => {},
			complete: () => {}
		});
	})
}
// 排行榜详情接口
export function list(listId){
	return new Promise (function(reslove,reject){
		uni.request({
			    url: `${baseUrl}/top/list?idx=${listId}`,
				method: 'GET',
			    success: res => {
					reslove(res)
				},
			    fail: () => {},
			    complete: () => {}
		});
	})
}
// 歌曲详情接口
export function gequDetail(ids){
	return new Promise (function(reslove,reject){
		uni.request({
			    url: `${baseUrl}/song/detail?ids=${ids}`,
				method: 'GET',
			    success: res => {
					reslove(res)
				},
			    fail: () => {},
			    complete: () => {}
		});
	})
}
// 歌词接口
export function lyric(id){
	return new Promise (function(reslove,reject){
		uni.request({
			    url: `${baseUrl}/lyric?id=${id}`,
				method: 'GET',
			    success: res => {
					reslove(res)
				},
			    fail: () => {},
			    complete: () => {}
		});
	})
}
// 歌曲音频url接口
export function audio(id){
	return new Promise (function(reslove,reject){
		uni.request({
			    url: `${baseUrl}/song/url?id=${id}`,
				method: 'GET',
			    success: res => {
					reslove(res)
				},
			    fail: () => {},
			    complete: () => {}
		});
	})
}